<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>忘记密码</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">

	<meta http-equiv="Pragma"   content= "no-cache" /> 
	<meta http-equiv= "Cache-Control"   content= "no-cache" /> 
	<meta http-equiv= "Expires"   content= "0" />
	<link rel="stylesheet" type="text/css" href="/css/drag/htmleaf-demo.css">
	<link href="/css/drag/drag.css" rel="stylesheet" type="text/css"/>
	<link rel="stylesheet" href="/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="/css/user.css" media="all" />
</head>
<body >

<div style="width: 100%;">
	<form class="layui-form " style="margin: 0 30%;" id="foGet_from" action="">
		<input type="hidden" name="domain" value="">
		   <div class="layui-form-item">
				   <div class="layui-input-block">
					   <input type="tel" style="width: 300px;" name="userName" lay-verify="required" placeholder="登陆用户名"  autocomplete="off" class="layui-input">
				   </div>
		   </div>

		   <div class="layui-form-item">
				   <div class="layui-input-block">
					   <input type="tel" style="width: 300px;" name="phone" lay-verify="required|phone" placeholder="手机号码" autocomplete="off" class="layui-input">
				   </div>
		   </div>

		<div class="layui-form-item">
			<div class="layui-input-block">
				<div id="drag"></div>
			</div>

		</div>

		   <div class="layui-form-item">
			   <div class="layui-input-block">
				   <button class="layui-btn" lay-submit lay-filter="forGet">密码重置</button>
			   </div>
		   </div>

	</form>

	</div>
</div>
	<script type="text/javascript" src="/js/jquery-3.3.1.min.js"></script>
	<script type="text/javascript" src="/js/common.js"></script>
	<script type="text/javascript" src="/layui/layui.js"></script>
<script src="/js/drag/drag.js" type="text/javascript"></script>

<script type="text/javascript">
       var  drag_vlidate = $('#drag').drag();

		$(document).ready(function () {

            layui.config({
				base : "/layui"
			}).use(['jquery',"form"],function(){
				var  domain =  document.domain;
				$("#foGet_from input[name='domain']").val(domain);
			});
		});

		layui.use('form', function(){
			var form = layui.form;
			//监听提交
			form.on('submit(forGet)', function(data){
				if(drag_vlidate.isOk()){//滑块校验成功
					$.post("/forGet/restPassword",data.field,function (result) {
						if(result.code==1){

							layer.msg("密码修改成功,请重新登录");
							setTimeout(function(){
								window.location.href="/logout";
							},2000);
						}else {
							layer.msg(result.message)
						}
					});
				} else {//滑块校验失败
					layer.msg("请先完成滑块验证!")
				}


				return false;
			});
		});
	</script>
</body>
</html>